﻿using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Linq;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp3
{
    class Program
    {
        static void Main(string[] args)
        {
            //查找
            var selectString = "select * from Employee";
            using (var reader = SqlHelper.SqlOperate(selectString))
            {
                while (reader.Read())
                {
                    Console.WriteLine("{0}\t{1}\t{2}", reader["Name"], reader["Salary"], reader["DepartmentId"]);
                }
            }

            //插入
            var insertString = string.Format("insert into Employee (Name,Salary,DepartmentId) values ('{0}','{1}','{2}')", "jack", "83000", "1");
            SqlHelper.SqlOperate(insertString);

            //更新
            var updateString = string.Format("update Employee set Salary = '86000' where Id = 1010");
            SqlHelper.SqlOperate(updateString);

            //删除
            var deleteString = string.Format("delete from Employee where Id = 2005");
            SqlHelper.SqlOperate(deleteString);
        }
    }
}
